# -*- coding:utf-8 -*-
#Author LJ 
#Mail:admin@attacker.club
#Site:blog.attacker.club
#description
import re




while True:
    ip_input = input("输入IP：")
    pat = re.compile(r'([0-9]{1,3})\.')
    r = re.findall(pat,ip_input+".")
    if len(r)==4 and len([x for x in r if int(x)>=0 and int(x)<=255])==4:
        break
    else:
        print ("ip地址格式不对")

while True:
    mask_input = input("输入IP：")
    pat = re.compile(r'([0-9]{1,3})\.')
    r = re.findall(pat,ip_input+".")
    if len(r)==4 and len([x for x in r if int(x)>=0 and int(x)<=255])==4:
        break
    else:
        print ("ip地址格式不对")